<template>
  <div class="patient-number-date">
    <div class="patient-number-date-inside">
      <div class="header">
        <div class="left item">
          <img
              alt="左侧"
              src="@/components/assets/images/design/1-12.webp"
          />
        </div>
        <div class="middle item">请点击下方卡片 选择门诊类型</div>
        <div class="right item">
          <img
              alt="右侧"
              src="@/components/assets/images/design/1-12.webp"
          />
        </div>
      </div>
      <el-row class="patient-number-area">
        <template v-for="item in OPTypeOptionsInfo">
          <el-col :span="24">
            <div class="patient-number-item" @click="handleClick(item)">
              <div class="left">
                <div class="sign">{{ item.name }}</div>
                <div class="describe">{{ item.descInfo }}</div>
              </div>
              <div class="right" :class="{'expert-info':(item.id)===2}"/>
            </div>
          </el-col>
        </template>
      </el-row>
    </div>
  </div>
</template>

<script>
import {buildParentApi} from "@/utils/designer/util";
import {v4 as uuid} from "uuid";

let buildParent = buildParentApi();
export default {
  name: 'OPType',

  componentName: "OPType",

  components: {},

  data() {
    return {}
  },

  computed: {
    // 号源选项
    OPTypeOptionsInfo() {
      return this.$store.getters['DRCbiz/getOPTypeOptionsInfo']
    },

    // 当前选中的业务类型
    bizInfo(){
      return this.$store.getters['DRCbiz/getBizInfo']
    },

    // 选中的医院区域
    hospAreaInfo(){
      return this.$store.getters['DRCbiz/getHospAreaInfo']
    }
  },

  mounted() {
  },

  methods: {
    // 选择当前门诊类型-->获取该类型下的号别-->等待执行毁掉跳转号别列表
    handleClick(row) {
      const self = this;
      let params = Object();
      let paramInfo = Object();
      let bizInfo = (this.bizInfo);
      let hospAreaInfo= (this.hospAreaInfo);
      this.$store.dispatch('DRCbiz/setOPTypeInfo', row);
      let devInfo = localStorage.getItem('deviceInfo')
      Reflect.set(paramInfo, 'deviceIp', (devInfo?.screenIp));
      Reflect.set(paramInfo, 'flowId', uuid());
      Reflect.set(paramInfo, 'timestamp', self.$day().valueOf());
      Reflect.set(paramInfo, 'terminalNo', (devInfo?.screenId));
      Reflect.set(paramInfo, 'method', 'QueryDept');
      Reflect.set(paramInfo, 'hospCode', (hospAreaInfo?.id) || 1);
      // 1:预约&2:挂号
      Reflect.set(paramInfo, 'regMode', (bizInfo.id));
      // 1:普通&2:专家
      Reflect.set(paramInfo, 'regType', (row.level));
      Reflect.set(paramInfo, 'startDate', self.$day().format('YYYY-MM-DD'));
      Reflect.set(paramInfo, 'endDate', self.$day().format('YYYY-MM-DD'));
      Reflect.set(params, 'Request', paramInfo);
      let paramsInfo = this.$x2js.js2xml(params);
      buildParent.executeParentMethod('axiosRep', paramsInfo, 'QueryDept');
    }
  },
}

</script>

<style scoped lang="scss">
@import "assets/style";
</style>